using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Entities;
using Bll;

public partial class Service_TopRatingProduct : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataBind();

    }
    protected void rpHotProduct_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "AddToCart")
        {
            string proID = e.CommandArgument.ToString();
            if (!string.IsNullOrEmpty(proID))
            {
                CartBll cart = (CartBll)HttpContext.Current.Session["ShoppingCart"];
                if (cart == null)
                {
                    cart = new CartBll();
                    cart.Add(proID);
                    HttpContext.Current.Session["ShoppingCart"] = cart;
                    Response.Redirect("shoppingcart.aspx");
                }
                else
                {
                    cart.Add(proID);
                    HttpContext.Current.Session["ShoppingCart"] = cart;
                    Response.Redirect("shoppingcart.aspx");
                }

            }

        }
    }
}
